package com.mzx.javase.thread.concurrent;

import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 类描述：线程安全的Set,会自动去重，数据的放入和取出顺序一致
 *
 * @ClassName CopyOnWriteArraySetTest
 * @Description TODO
 * @Author 马子鑫
 * @Date 2022/8/17 9:28
 * @Version 1.0
 */
public class CopyOnWriteArraySetTest {
    public static void main(String[] args) {
        CopyOnWriteArraySet<String> arraySet = new CopyOnWriteArraySet<>();
//        ExecutorService executorService = Executors.newFixedThreadPool(5);
//        for (int i = 0; i < 5; i++) {
//            executorService.submit(new Runnable() {
//                @Override
//                public void run() {
//                    for (int j = 0; j < 10; j++) {
//
//                    }
//                }
//            })
//        }
        arraySet.add("zhagnsan");
        arraySet.add("lisi");
        arraySet.add("LIsa");
        arraySet.add("lisi");
        arraySet.add("Mark");
        arraySet.add("marry");
        System.out.println(arraySet);
    }
}
